import React, { Component } from 'react';
import { CateGoryTop } from '../style'
class Top extends Component {
    changeTopButton = index => this.props.setTopActiveIndex(index)
    render() {
        let{ topActiveState } = this.props
        return (
            <CateGoryTop>
                <ul>
                    <li className={topActiveState === 0 ? "active" :""}  onClick={ () => this.changeTopButton(0) }  >分类</li>
                    <li className={topActiveState === 1 ? "active" :""} onClick={ () => this.changeTopButton(1) }>食材</li>
                    <li className={topActiveState === 1 ? "slider right" :"slider"} ></li>
                </ul>
            </CateGoryTop>
        );
    }
}

export default Top;
